package cbfg.popup.demo

import android.os.Bundle
import android.view.View
import android.widget.TextView
import android.widget.Toast
import cbfg.popup.BDialogFragment
import kotlinx.android.synthetic.main.fragment_slide_in_bottom.view.*

/**
 * @author:  Tom Hawk
 * 添加时间: 2020/9/9 13:06
 * 功能描述:
 */
class SlideInBottomDF : BDialogFragment() {
    init {
        mLayoutRes = R.layout.fragment_slide_in_bottom
        /**
         * Note:自定义的 theme 要继承 Popup_NormalTheme
         */
        setStyle(STYLE_NORMAL, R.style.SlideInBottomTheme)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        val listener = View.OnClickListener {
            Toast.makeText(it.context, "Click ${(it as TextView).text}", Toast.LENGTH_SHORT).show()
            dismiss()
        }
        view.tvOption1.setOnClickListener(listener)
        view.tvOption2.setOnClickListener(listener)
        view.tvOption3.setOnClickListener(listener)
    }
}